<template>
    <h2>公告显示页面</h2>
    公告标题:
    <input type="text" v-model="name">
    公告类型:
     <select v-model="lid">
                    <option :value="-1">请选择</option>
                    <option v-for="item in Lei" :value="item.lid">{{item.lname}}</option>
    </select>
    
    <input type="button" value="查询" @click="Show">
    <input type="button" value="导出" @click="Dao">
    <table border="1">
        <tr>
            <td>公告编号</td>
            <td>公告标题</td>
            <td>公告日期</td>
            <td>公告内容</td>
            <td>公告类型</td>
            <td>操作</td>
        </tr>
        <tr v-for="item in info">
            <td>{{item.tid}}</td>
            <td>{{item.tName}}</td>
            <td>{{item.tDate.substring(0,19)}}</td>
            <td>{{item.tinfo}}</td>
            <td>{{item.lname}}</td>
            <td>操作</td>
        </tr>
    </table>
</template>
<script setup lang="ts">
import axios from 'axios';
import { ref ,onMounted, initCustomFormatter} from 'vue';
onMounted(()=>{
    Show();
    Bind();
})
//绑定下拉框
const Lei=ref([{
    "lid": 0,
    "lname": ""
}])
const Bind=()=>{
    axios.get("https://localhost:7218/api/Title/ShowTitleLei")
    .then(res=>{
        Lei.value=res.data
    })
}
const info=ref([{
"tid": 0,
    "tName": "",
    "tDate": "2025-01-06T02:16:21.851",
    "tinfo": "",
    "lid":0,
    "lname": ""
}])
const name=ref("")
const lid=ref(-1)
const Show=()=>{
    axios.get("https://localhost:7218/api/Title/ShowTitle",{
        params:{
            name:name.value,
            lid:lid.value
        }
    })
    .then(res=>{
        info.value=res.data
    })
}
const Dao=()=>{
  
       
   alert("导出成功");
}
</script>